{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "69047d31",
   "metadata": {},
   "source": [
    "#### 从列表中删除对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "df6f76a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums = [1,2,3,4]\n",
    "nums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "43b2a78a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 4]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums = [1,2,3,4]\n",
    "nums.remove(3)\n",
    "nums"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b177ee46",
   "metadata": {},
   "source": [
    "#### 从列表中弹出对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d4f738f6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums.pop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "83220fe3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "aa5d50f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums.pop(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "96ca3d24",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[2]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c3e3fa6a",
   "metadata": {},
   "source": [
    "####  用列表扩展对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "ed399e7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[2, 3, 4]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums.extend([3,4])\n",
    "nums"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f9c08f7",
   "metadata": {},
   "source": [
    "#### 在列表中插入一个对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4adf7156",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums.insert(0,1)\n",
    "nums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6c51408b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 'two-and-a-half', 3, 4]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums.insert(2,\"two-and-a-half\")\n",
    "nums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0f5c6efc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
